package com.zgc.demo.j2dbc.controller;

import com.zgc.demo.j2dbc.db.UserRepository;
import com.zgc.demo.j2dbc.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestDbController {
    @Autowired
    UserRepository userRepository;

    @GetMapping
    public String getOneUser() {
        final User user = userRepository.findById(1L).block();
        return user.toString();
    }
}
